<template>
	<view class="container">
		<view class="account-list">
			<view class="account-item" v-for="(account, index) in accounts" :key="account.id"
				@click="goToEdit(account)">
				<view class="account-info">
					<text class="account-name">{{ account.name }}</text>
					<text class="account-number">{{ account.number }}</text>
				</view>
				<uni-icons type="right" size="20"></uni-icons>
			</view>
		</view>
		<view class="add-btn-wrapper">
			<button class="add-btn" type="primary" @click="goToAdd">添加账户</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				accounts: [
					// 示例数据，实际可从API获取
					{
						id: 1,
						name: '支付宝',
						number: '1234567890'
					},
					{
						id: 2,
						name: '微信',
						number: 'wxid_abcdefg'
					}
				]
			}
		},
		methods: {
			goToEdit(account) {
				this.$tab.navigateTo(`/pages/mine/info/accountManage?id=${account.id}`)
			},
			goToAdd() {
				this.$tab.navigateTo('/pages/mine/info/accountManage')
			}
		}
	}
</script>

<style>
	.container {
		padding: 20rpx;
		background: #f8f8f8;
		min-height: 100vh;
	}

	.account-list {
		margin-bottom: 40rpx;
	}

	.account-item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		background: #fff;
		padding: 30rpx 20rpx;
		border-radius: 16rpx;
		margin-bottom: 20rpx;
		box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
	}

	.account-info {
		display: flex;
		flex-direction: column;
	}

	.account-name {
		font-size: 32rpx;
		color: #333;
		margin-bottom: 8rpx;
	}

	.account-number {
		font-size: 28rpx;
		color: #888;
	}

	.add-btn-wrapper {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 40rpx;
		display: flex;
		justify-content: center;
	}

	.add-btn {
		width: 80vw;
		font-size: 32rpx;
		border-radius: 50rpx;
	}
</style>